{if $admin_request eq 'custom_pages'}
<div id="browse-records">
    <div id="tabs">
        <ul>
            <li>
                <a href="#tabs-new">{$lang.$base_request.t_addnew}</a>
            </li>
            <li>
                <a href="#tabs-existing">{$lang.$base_request.t_view}</a>
            </li>
        </ul>
        <div id="tabs-new">
            <div id="new-data">
                {include file="_admin/inc/inc_forms.tpl" fprefix="new"}
            </div><!-- //new-data -->
        </div><!-- //tabs-new -->
        <div id="tabs-existing">
            <table id="table-{$admin_request}" class="display datatable">
                <thead>
                    <tr>
                        {foreach $pv.settings.listing as $item} <th> {$lang.$base_request.$item} </th>
                        {/foreach} <th> {$lang.actions} </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td colspan="3" class="dataTables_empty">Loading data from server</td>
                    </tr>
                </tbody>
            </table>
        </div><!-- //tabs-existing -->
    </div><!-- //tabs -->
</div><!-- //browse-records -->
<div id="edit-record" class="ui-helper-hidden"></div><!-- //edit-record -->
{capture "$admin_request"}

_sid ='{$user.session_id}';

$('#squeeze_page_list a').fancybox();

{literal}

$('#table-{/literal}{$admin_request}{literal}').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",

"bProcessing": true,
"bServerSide": true,
"sAjaxSource": _urlbegin + '/listing-{/literal}{$admin_request}/' + _urlend + _ajax,

"aoColumns": [
{$pv.settings.listing_js}
{literal}
{ "mDataProp": "actions","bSortable": false  }
],
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"global": false,
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
} );

{/literal}

{/capture}

{/if} {* browse *}

{if $admin_request eq 'edit-custom_pages'}
<div id="save-data">
    <form action="" onSubmit="return false;" id="savedataform" class="ui-form">
        <ul>
            <li class="ui-widget-header">
                {$lang.$admin_page.$base_request.pn}
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="required" for="save-page_name"> {$lang.$base_request.page_name} </label>
                </div>
                <div class="column second">
                    <input type="text" name="page_name" id="save-page_name" value="" class="required check" data-formid="savedataform" data-id="{$pv.data.id}" />
                    <span class="sprite-icons sprite-blankex" id="check-savedataform-page_name"></span>
                </div>
                <div class="column third">
                    This name appears on navigation menu
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="required" for="save-page_url"> {$lang.$base_request.page_url} </label>
                </div>
                <div class="column second">
                    <input type="text" name="page_url" id="save-page_url" value="" class="required check" data-formid="savedataform" data-id="{$pv.data.id}" />
                    <span class="sprite-icons sprite-blankex" id="check-savedataform-page_url"></span>
                </div>
                <div class="column third">
                    Page link (URL) will be
                    <dt class="ui-state-highlight">
                        http://www.example.com/[page url]/index.html
                    </dt>
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="required" for="save-page_title"> {$lang.$base_request.page_title} </label>
                </div>
                <div class="column second">
                    <input type="text" name="page_title" id="save-page_title" value="" class="required" />
                </div>
                <div class="column third">
                    Information
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="" for="save-page_desc"> {$lang.$base_request.page_desc} </label>
                </div>
                <div class="column second">
                    <input type="text" name="page_desc" id="save-page_desc" value="" class="" />
                </div>
                <div class="column third">
                    Information
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="" for="save-page_keywords"> {$lang.$base_request.page_keywords} </label>
                </div>
                <div class="column second">
                    <input type="text" name="page_keywords" id="save-page_keywords" value="" class="" />
                </div>
                <div class="column third">
                    Information
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="required" for="save-page_group"> {$lang.$base_request.page_group} </label>
                </div>
                <div class="column second">
                    <select id="page_group" name="save-page_group" class="chzn-select required">
                        <option value="user" selected>User Defined</option>
                        <option value="sys">System</option>
                    </select>
                </div>
                <div class="column third">
                    Information
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="required" for="save-navigation_menu"> {$lang.$base_request.navigation_menu} </label>
                </div>
                <div class="column second">
                    <input type="radio" name="navigation_menu" id="save-navigation_menu" value="1" checked />
                    &nbsp;{$lang.yes}&nbsp;&nbsp;
                    <input type="radio" name="navigation_menu" value="0" />
                    &nbsp;{$lang.no}
                </div>
                <div class="column third">
                    This activates the page on navigation menu
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="required" for="save-"> {$lang.$base_request.exclude_template} </label>
                </div>
                <div class="column second">
                    <input type="radio" name="exclude_template" value="1" />
                    &nbsp;{$lang.yes}&nbsp;&nbsp;
                    <input type="radio" name="exclude_template" id="save-exclude_template" value="0" checked />
                    &nbsp;{$lang.no}
                </div>
                <div class="column third">
                    Exclude design template and create a stand-alone page with a look defined by the default content (e.g. Squeeze pages)
                </div>
            </li>
            <li class="columns on-3">
                <div class="column first">
                    <label class="required" for="save-exclude_title"> {$lang.$base_request.exclude_title} </label>
                </div>
                <div class="column second">
                    <input type="radio" name="exclude_title" value="1" />
                    &nbsp;{$lang.yes}&nbsp;&nbsp;
                    <input type="radio" name="exclude_title" id="save-exclude_title" value="0" checked />
                    &nbsp;{$lang.no}
                </div>
                <div class="column third">
                    Exclude design template and create a stand-alone page with a look defined by the default content (e.g. Squeeze pages)
                </div>
            </li>
            <li class="">
                <div class="columns on-3 heading">
                    <div class="column first">
                        <label class="" for="save-page_squeeze"> {$lang.$base_request.page_squeeze}</label>
                    </div>
                    <div class="column second">
                        <input type="checkbox" name="page_squeeze" id="save-page_squeeze" value="1" class="trigger-toggle onchecked" data-related="squeeze_pages" />
                    </div>
                    <div class="column third">
                        Before you can create a Squeeze Page, you must <a href="#@TODO-linkhere-">create the form</a> that will collect information
                    </div>
                </div>
                <div id="squeeze_pages" class="ui-helper-hidden-accessible">
                    <div class="columns on-2 mb-1em">
                        <div class="column first">
                            {$lang.$base_request.squeeze_form}
                        </div>
                        <div class="column second">
                            <select id="save-squeeze_form" name="squeeze_form" class="chzn-select">
                                <option value="">{$lang.please_select}</option>
                                {foreach $pv.data.custom_forms as $item} <option value="{$item.id}">{$item.f_name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="columns on-2">
                        <div class="column first">
                            {$lang.$base_request.squeeze_page}
                        </div>
                        <div class="column second">
                            <ul id="squeeze_page_list">
                                <li>
                                    <input type="radio" name="squeeze_page" value="1" checked />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Burned Landlord.jpg" title="Burned Landlord" data-fancybox-group="squeeze-pages">Burned Landlord</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="2" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Stop Foreclosure.jpg" title="Stop Foreclosure" data-fancybox-group="squeeze-pages">Stop Foreclosure</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="3" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Join Buyers List.jpg" title="Join Buyers List" data-fancybox-group="squeeze-pages">Join Buyers List</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="4" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Forecosure Listings.jpg" title="Forecosure Listings" data-fancybox-group="squeeze-pages">Forecosure Listings</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="5" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Motivated Sellers.jpg" title="Motivated Sellers" data-fancybox-group="squeeze-pages">Motivated Sellers</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="6" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Stop Foreclosure On Its Tracks.jpg" title="Stop Foreclosure On Its Tracks" data-fancybox-group="squeeze-pages">Stop Foreclosure On Its Tracks</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="7" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/24-Hour Offer.jpg" title="24-Hour Offer" data-fancybox-group="squeeze-pages">24-Hour Offer</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="8" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/24-Hour Offer Lite.jpg" title="24-Hour Offer Lite" data-fancybox-group="squeeze-pages">24-Hour Offer Lite</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="9" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Handyman Special -Wholesale Buyers List.jpg" title="Handyman Special -Wholesale Buyers List" data-fancybox-group="squeeze-pages">Handyman Special -Wholesale Buyers List</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="10" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Private Money Lenders.jpg" title="Private Money Lenders" data-fancybox-group="squeeze-pages">Private Money Lenders</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="11" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Problem Property.jpg" title="Problem Property" data-fancybox-group="squeeze-pages">Problem Property</a>
                                </li>
                                <li>
                                    <input type="radio" name="squeeze_page" value="12" />
                                    &nbsp;<a href="{$config.docroot}upload/static/images/squeeze_pages/Wholesale Squeeze Page.jpg" title="Wholesale Squeeze Page" data-fancybox-group="squeeze-pages">Wholesale Squeeze Page</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </li>
            <li>
                <div class="heading">
                    <label class="" for="save-content"> {$lang.$base_request.content} </label>
                </div>
                <div class="">
                    <textarea id="save-content" name="content" class="ui-helper-hidden"></textarea>
                    <div class="wysiwyg" data-related="save-content"></div>
                </div>
            </li>
        </ul>
        <ul class="no-stripes">
            <li class="borderless">
                <label class="display-ib borderless"> </label>
                <button class="ui-button ui-state-default ui-corner-all form-trigger" data-action="new" data-formid="newdataform">
                    <span class="sprite-icons sprite-add icon-holder"></span>
                    <span>{$lang.forms.add}</span>
                </button>
            </li>
        </ul>
    </form>
</div>
<script type="text/javascript">
$(function(){ldelim}
{include file="_admin/inc/inc_js_edit.tpl"}

$('#save-data .chzn-select').chosen().css('display', '').addClass('ui-helper-hidden-accessible');

$('#save-page_group').val("{$pv.data.page_group}").trigger("liszt:updated");
$('#save-squeeze_form').val("{$pv.data.squeeze_form}").trigger("liszt:updated");

{literal}
$('#save-data .wysiwyg').elrte({
toolbar: "eldorado"
});

{/literal}
{rdelim});
</script>
{/if} {* edit *}